package configuration.dataObjects
{
	import mx.collections.ArrayCollection;
	//import common.utils.DateManager;
	
	[Bindable]
	public class ReceivingPreferenceDO
	{
		public var INTERNAL_PREF_NUM:String = "0";
		public var PREFERENCE_NAME:String = "";
		public var AUTO_ASSIGN_LPN:String = "N";
		public var AUTO_PUTAWAY:String = "N";
		public var ALLOW_OVER_RECEIVING:String = "N";
		public var ACTIVE:String = "Y";
		public var AUTO_LOCATE:String = "N";
		public var AUTO_CHECKIN:String = "N";

		public function ReceivingPreferenceDO()
		{
		}

		public function Init(xmlObj:XML):void{
			if(null == xmlObj)
				return;
			else{
				for each (var itemProp:XML in xmlObj.children()) {			
					this[itemProp.name()] = itemProp;
				}
			}
		}
		
		public function ToXML():XML{
			var xmlObj:XML =
			<RECEIVING_PREFERENCE>
				<INTERNAL_PREF_NUM>{INTERNAL_PREF_NUM}</INTERNAL_PREF_NUM>
				<PREFERENCE_NAME>{PREFERENCE_NAME}</PREFERENCE_NAME>
				<AUTO_ASSIGN_LPN>{AUTO_ASSIGN_LPN}</AUTO_ASSIGN_LPN>
				<AUTO_PUTAWAY>{AUTO_PUTAWAY}</AUTO_PUTAWAY>
				<ALLOW_OVER_RECEIVING>{ALLOW_OVER_RECEIVING}</ALLOW_OVER_RECEIVING>
				<ACTIVE>{ACTIVE}</ACTIVE>
				<AUTO_LOCATE>{AUTO_LOCATE}</AUTO_LOCATE>
				<AUTO_CHECKIN>{AUTO_CHECKIN}</AUTO_CHECKIN>		
			</RECEIVING_PREFERENCE>;
			return xmlObj;
		}
		
		public static function getItems(list:XMLList):ArrayCollection
		{
			var ac:ArrayCollection = new ArrayCollection();
			for each(var xml:XML in list)
			{
				var itm:ReceivingPreferenceDO = new ReceivingPreferenceDO();
				itm.Init(xml);
				ac.addItem(itm);
			}
			return ac;
		}

	}
}